package cn.cai;

import cn.cai.pojo.EasyExcelObj;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.Map;

public class EasyExcelLesner extends AnalysisEventListener<EasyExcelObj> {


    /**
     * 一行一行读取的  有多少行，调用多少次
     * @param data 读取的一行数据
     * @param context
     */
    @Override
    public void invoke(EasyExcelObj data, AnalysisContext context) {

        if (data == null){
            System.out.println("读取到了空文件");
        }
        System.out.println(data);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {

    }

    //读取表头内容
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头："+headMap);
    }

}
